import sqlite3

class T10(object):
    def __init__(self) -> None:
        self.dataBase = 'data.db'
        self.table = 'T10'
        pass

    def execute(self,sql):
        conn = sqlite3.connect('data.db')
        cursor = conn.cursor()
        cursor.execute(sql)
        conn.commit()
        conn.close()
    def query(self,key,value):
        sql = "SELECT * FROM T10 WHERE {key}='{value}'".format(key=key,value=value)
        self.execute(sql)
    def add(self,data):
        sql = "INSERT INTO T10 (time,WBT,Temp,Humi,DBT) VALUES ('{time}',{WBT},{Temp},{Humi},{DBT});".format(time=data[0],WBT=data[1],Temp=data[2],Humi=data[3],DBT=data[4])
        self.execute(sql)
    def delete(self,key,val):
        sql = "DELETE FROM T10 WHERE {key}={val}".format(key=key,val=val)
        self.execute(sql)
